<template>
  <div class="title-divider" v-if="title">
    <slot></slot>
  </div>
  <el-divider v-bind="$attrs" v-else>
    <template v-for="name in Object.keys($slots)" #[name]>
      <slot :name="name"></slot>
    </template>
  </el-divider>
</template>

<script setup lang="ts">
defineOptions({ name: 'XuDivider' })

defineProps({
  title: {
    type: Boolean,
    default: false,
  },
})
</script>

<style lang="scss" scoped>
.title-divider {
  padding-left: 10px;
  margin: 10px 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  border-left: 5px solid var(--el-color-primary);
}
</style>
